package com.khotyn.heresy.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.bind.support.SessionStatus;

import com.khotyn.heresy.bean.Album;

/**
 * 用户登录的控制器
 * 
 * @author 王长乐
 * 
 */
@Controller
@SessionAttributes("userID")
public class MergeAlbumController {

	@RequestMapping(value = "/mergeAlbumList.html", method = RequestMethod.GET)
	public String onLoad(ModelMap model, SessionStatus status, @ModelAttribute("userID") Integer userID) {
		if (userID == null)
			return "login";
		else

			return "mergeAlbumList";

	}

	@RequestMapping(value = "/mergeAlbumList.html", method = RequestMethod.POST)
	public String processSubmit(ModelMap model, @ModelAttribute("userID") Integer userID, BindingResult result, SessionStatus status) {
		List<Album> albumList = new ArrayList<Album>(); // @TODO:得到要合并的相册；

		if (albumList.size() == 0)
			return "mergeAlbumList";
		return "s";
	}

}
